<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysql_log')->create('log_cron', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('调度任务运行日志');

            $table->id();
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->string('type', 16)->comment('类型')->default('');
            $table->string('cron_name', 64)->comment('脚本名')->default('');
            $table->integer('run_day')->comment('运行')->unsigned()->default(0);
            $table->tinyInteger('status')->comment('状态')->unsigned()->default(0);
            $table->double('start_time', 15, 4)->comment('开始时间')->unsigned()->default(0);
            $table->double('end_time', 15, 4)->comment('结束时间')->unsigned()->default(0);
            $table->double('run_time', 15, 4)->comment('运行时长')->unsigned()->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysql_log')->dropIfExists('log_cron');
    }
};
